Self-adapting method and device for the inlaying of color video images

ABSTRACT

The method for the inlaying of color video images consists on the one hand in generating a switching signal, or dividing key, applying a gain on the image points belonging to the contour of the subject to be inlaid, in proportion to the distance value (DIST) between the color of the point and that of the back-ground, and on the other hand in carrying out a mixing of the source image and a new background image which is a function of the value of the dividing key signal at the point in question and such that the values of the source signal and of the new background signal are fixed at constants over the width of the contour.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a self-adapting method and device forthe inlaying of colour video images.

2. Description of the Related Art

The inlaying of colour video images consists in extracting, from asource image, a subject, such as a person or an object, moving in frontof a uniform colour background in order to place it in front of a newbackground.

It is known to define the uniform colour background in the plane C_(R)C_(B) (with C_(R) =R-Y, C_(B) =B-Y, where B, R, Y represent the bluecolour signal, the red colour signal and the luminance respectively) bya closed area constituted by a quadrilateral. During the analysis of thesource image, line by line and point by point, a point is considered asbelonging to the background if its components C_(R) and C_(B) are insidethe quadrilateral; it is considered as belonging to the section to beinlaid in the opposite case. Thus, with each line of the source imagethere corresponds a "key" or switching signal which, for example, hasthe value 1 for the part to be inlaid and the value 0 for thebackground, or vice-versa. However, this "key" signal does not allow arealistic rendering of the inlaid image, as the background/subjecttransitions are very sharp and the contours of the inlaid subject arejagged. An improvement in the rendering of the inlaid image is obtainedby smoothing the background/subject transition in order to mask thejagged contours by introducing a gain function in the dividing keysignal. But in this case, it is not possible to reproduce fine details,nor transparency, nor shadows, and an edge of the same colour as that ofthe background (generally blue) is apparent on the contour of thesubject.

Another method of inlaying images is disclosed in the French patent No.79 20820 lodged in the name of the Applicant. It consists in carryingout a linear division of the subject to be inlaid using a channel with ahigh fixed gain allowing the provision of a clean division for thesections of the image having no colorimetric ambiguity, and a variablegain channel allowing both the restoration of a transparency effect andthe creation of a fade following the fine details around the subject.The shadow effect is obtained by detecting the low luminance levels andby causing the corresponding attenuation of the new background. However,although the shadow effect is well rendered, the fine details areattenuated and the transparency exhibits a colouring of the formerbackground. Furthermore, for slow transitions, the presence of an edgeof the same colour as the background, that is to say bluish, is stillpresent.

Another method of inlaying images, in principle different from that oflinear mixers, allows the inlaying of a red, green, blue (R, G, B)source image for a subject moving in front of a very pure blue, green(and possibly red) background. The method consists firstly ineliminating the background colour in the source image by subtraction,allowing the subject to remain as though it were placed in front of ablack background. The new background is then introduced into the sourceimage, in the zone previously occupied by the coloured background, inproportion to the luminosity and the visibility of the latter. Thetransparencies or semi-transparencies such as glass, smoke or fog, aretherefore entirely retained. As the source image is never switched, thefine details are also fully reproduced in the inlaid image. A blue(green or red respectively) locking module allows the elimination ofreflections of the coloured background on the subject in the inlaidimage. Besides the fact that this method necessitates a very largenumber of adjustments in order to obtain a quality inlaid image, auniform and pure background is necessary. Any non-uniformity of thebackground is reproduced in the inlaid image thus polluting the newbackground. Although it is possible to avoid this pollution of the newbackground by using a continuous and instantaneous zeroing of thecoloured background of the source image, it is then no longer possibleto reproduce transparency and shadow. Furthermore, the elimination ofreflections of the background on the subject gives rise, depending onthe colour of the background used, to degradations in certain colours(for example magenta is the background is blue, yellow and flesh if thebackground is green).

SUMMARY OF THE INVENTION

The subject of the present invention is a method for the inlaying ofcolour video images allowing the avoiding, or at least the reduction, ofthese disadvantages without necessitating a high number of adjustments.This is achieved in part by working on the contours of the subject to beinlaid, by carrying out a dynamic monitoring thereof allowing theobtaining of a dividing gain dependent exclusively on thebackground/subject transition in question; this allows an automaticadjustment of the gain which differs according to whether thebackground/subject transition is wide or narrow and contributes to theelimination of the fringe of background colour (blue for a bluebackground) around the subject. Furthermore, the mixing between thesubject and the new background, applied according to the dividing keyobtained, even though linear in principle, no longer takes into accountthe values of points belonging to the transition but constant values ofthe subject and of the new background determined at the start and end oftransition. The linear mixing between subject and new backgroundtherefore no longer makes use of values of the source image containingblue arising from the coloured background and therefore also contributesto the elimination of the blue edge around the inlaid subject. Finally,the fine details, shadows and transparencies are detected in the sourceluminance image and reinjected in the inlaid image in proportion totheir luminance level according to a linear method with two thresholds,a low threshold allowing avoidance of reinjection of the noise of thecoloured background, a high threshold allowing the determination of therates of details, shadows and transparencies of the source image to betransferred into the inlaid image. Different adjustments are possiblefor the sections which are darker than the background and for thesections which are lighter. Finally, a desaturation of the newbackground is carried out according to the same principle in thoseplaces where elements have been inlaid possibly with a capability ofrecolouring the latter.

According to the invention, the method for the inlaying of colour videoimages, consisting in the generation of a switching signal, or dividingkey signal, to which a gain is applied in order to extract from a sourceimage a subject placed in front of a uniform colour background and incarrying out a mixing of the source image and a new background image,comprising the steps of

detecting background/subject and subject/background transitions (T)dynamically in the source image according to the evolution of a distancevalue (DIST) between the colour of the points of the source image andthat of the background and defining a contour of the subject of variablewidth depending on characteristics of the transition,

applying the gain only to points of the source image defined asbelonging to the contour of the subject, and in proportion to thedistance value (DIST) between a selected point belonging to the contourand another point belonging to the background.

The subject of the invention is also a device for the implementation ofthis method.

Other characteristics and advantages of the invention will appearclearly in the following description given by way of non-limitativeexample with reference to the appended figures which show:

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1, a block diagram of the device for implementing the methodaccording to the invention,

FIG. 2, a block diagram for the obtaining of the dividing key signalaccording to the invention,

FIG. 3, an example of a binary dividing key signal,

FIG. 4, an example of a graph of the distances in the vicinity of atransition T,

FIG. 5, an example of a contour of variable width, according to theinvention,

FIG. 6, an illustration of the reduction of the interval of thedistances on a contour according to the invention,

FIG. 7, an example of a flowchart allowing the computation of a dividingkey with gain according to the invention,

FIG. 8, an example of the inlaying of luminance details according to theinvention,

FIG. 9, an example of the inlaying of chrominance details according tothe invention.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

The source video signal containing the subject to be inlaid placed infront of a uniform coloured background, for example blue, is composed ofa luminance signal Y, a red colour difference signal, C_(R), and a bluecolour difference signal, C_(B), such that C_(R) =R-Y and C_(B) =B-Y.These signals Y, C_(R), C_(B) are sampled and digitised. The sampling ofthe signals can be carried out, for example, at frequenciescorresponding to the international standard, that is 13.5 MHz for theluminance signal, which corresponds to 720 points per line, and 6.75 MHzfor each colour difference signal, which corresponds to 360 points perline.

Similarly, the encoding for digitising the signals can be, for example,chosen according to the international standard, that is to say anencoding using eight bits per sample for each of the luminance signals Yand colour difference signals C_(R) and C_(B). The eight bit encodingdistinguishes 2⁸ =256 levels distributed over the maximum amplitude ofvariation of the three encoded components Y, C_(R), C_(B).

FIG. 1 is a block diagram of the device for implementing the methodaccording to the invention. The implementing of the method necessitatesmeans 3 of interpolation of the colour difference signals C_(R), C_(B)coming from the source video image 1 in order to obtain an identicalnumber of samples for the colour difference signals and the luminancesignal, means 4 of computing the dividing key allowing the inlaying ofthe subject in luminance from the interpolated colour differencesignals, means 5 forming a low pass filter receiving, on input, theluminance dividing key signal Y and supplying, on output, the dividingkey signal C_(R) /C_(B) allowing the inlaying of the colour differencesignals, means 6 receiving, on input, the source colour differencesignals C_(R), C_(B) coming from the source video image 1 and backgroundcolour difference signals C_(R), C_(B) coming from the new backgroundvideo image 2, as well as the dividing key signal C_(R) /C_(B) in orderto carry out the inlaying of the colour difference signals, means 7receiving on input the Y source and Y background luminance signals aswell as the dividing key signal Y in order to carry out the inlaying ofthe luminance signal, and means 8 receiving on input the luminancesignals Y and colour difference signals C_(R), C.sub. B of the sourcevideo signal and of the video signal after inlaying as well as thedividing key signal Y, allowing the carrying out of the inlaying ofdetails, shadows and transparencies and the obtaining of the finalinlaid image 9.

FIG. 2 is a block diagram of a device for obtaining the dividing keysignal according to the invention. A dividing key signal allowing theprocessing of the luminance Y, is obtained from the colour differencesignals C_(R) and C_(B). Now, as the colour difference signals C_(R),C_(B) are sampled at a frequency which is half that of the luminancesignal Y, only one item of information in every two items can be used.In order to double the number of samples, an interpolation device 3computes the missing samples C_(Ri), C_(Bi) (odd indices), for example,using a digital filtering formula dependent on the interpolating filterused. The interpolated signals C_(R), C_(B) are then used in thedividing key computing device 4. Firstly a distance DIST between thecolour of the point in question and the characteristic colour of thebackground is computed in the distance computing device 40, for eachpixel of the image, such that:

    DIST=[(C.sub.R -C.sub.R background).sup.2 +(C.sub.B -C.sub.B background).sup.2 ]1/2.

The background parameters C_(R) background and C_(B) background, areautomatically acquired or supplied by the user. For this purpose, theuser enters a rectangular window on the coloured background consideredas representative of the latter. The values C_(R) background and C_(B)background are then obtained by taking the average of the values C_(R)and C_(B) for all of the points belonging to the entered window. Themore the window is extended, the less the average value is sensitive tobackground noise and the better is its characterisation of the latter.The background/subject differentiation is produced, for example, bycharacterising the background with a circle of centre (C_(R) background,C_(B) background), and of radius R threshold in the plane (C_(R),C_(B)). The points inside this circle are considered as belonging to thebackground, the others to the subject.

For each point, the values of (C_(R) -C_(R) background) and (C_(B)-C_(B) background) are squared and summed and then the square root isextracted in order to obtain the Euclidean distance DIST between thecolour of any point in the source image and the background colour, inthe chromatic plane (C_(R), C_(B)). The distance signal DIST is thencompared, in a comparison device 41, with a threshold distance valuecorresponding to the points of radius R threshold in order to obtain abinary dividing key of the subject. The points whose distance is lessthan this threshold are considered as belonging to the background(key=0), the others as belonging to the subject. The adjustment of thevalue of the threshold allows the optimisation of the background/subjectdifferentiation. When the comparison of the Euclidean distance betweenthe subject and the background with the threshold value has been carriedout, the dividing key obtained is a binary key. The use of this key forswitching the subject to be inlaid would give rise, as has already beensaid, to jagged and bluish contours, hence the necessity of introducinga gain function in the dividing key. The type of the transition isdefined by the detected width of the contour: a narrow contourcorresponds to a sharp transition, a wide contour to a slow transition.All of the points belonging to a background/subject transition areconsidered as contour points. Contrary to the prior art, the gain isapplied only to the background/subject transitions of the source imageand in a way which is variable depending on the width of the contours,in order to retain the same type of transition in the inlaid image, toeliminate the blue fringes and the impression of jagged contours It istherefore necessary to detect the background/subject transitions and tocharacterise their type.

The extraction of a contour of variable width by an extraction device42, is carried out on each image line on the basis of a binary dividingkey signal such as that shown in FIG. 3 for example. The binary dividingkey signal allows the detecting of background/subject transitions orsubject/background transitions. For each image line, when a transition Tis detected, the points located on either side of the transition T arestudied in order to determine the width of the transition. For thispurpose a monitoring of the graph of the distances is carried out pointby point in the vicinity of the transition T.

FIG. 4 shows an example of a graph of distances for points located inthe vicinity of a transition T. For a background/subject transition, aslong as the distance value of a point located after (and beforerespectively) the transition T increases (and decreases respectively)sufficiently (for example 4 standardised units) with respect to thedistance value of the preceding point (or following point respectively),this point is considered as a contour point. For a subject/backgroundtransition, the width of the transition is determined in the same waybut with a decrease in the distance value after the transition and anincrease before the transition. The image of the contour points isobtained when all of the lines of the image have been travelled.

FIG. 5 shows an example of a contour of variable width for which thevalue 1 has been allocated to points belonging to the contour and thevalue 0 to points not belonging to the contour. A maximum width of thecontour can be adjusted by the user, in order to limit the width of thetransitions and to voluntarily sharpen them (for example 20 points).

The computation of the gain by a computing device 43 is then carried outfor each point belonging to a transition as a function of its distancevalue, the other points retaining their value defined by the binary key.For this purpose, for each line of the image, and for each transition,the minimum Dmin and maximum Dmax distances corresponding to the startand end of a transition are determined. The difference, Dmax-Dmin,between these minimum and maximum distances is computed and reduced inorder not to consider the distance values due to oscillations on eitherside of the transition introduced during the interpolating filtering.

The reduction in the difference, Dmax-Dmin, is carried out for exampleas follows:

    Dmin reduced=Dmin+20% (Dmax-Dmin)

    Dmax reduced=Dmax-5% (Dmax-Dmin)

The restriction of the interval is not symmetrical, because if all ofthe precautions taken on Dmin in order to avoid the oscillations do notgive rise to problems at the level of the inlaid image (a too fastpassage to the background level) the same precautions on Dmax riskcausing the retention of a section around the subject which cansometimes be large and thus generate a blue fringe on the inlaid image.In this case, it is preferable to retain certain oscillations ratherthan to introduce a blue edge around the subject. The gain is thereforecalculated on the contour points whose distance is included between thenew values Dmin reduced and Dmax reduced, and this is carried out in away which is proportional to the distance value of the point inquestion, in order to reproduce an identical transition in the inlaidimage.

FIG. 7 shows an example of a flowchart allowing the computation of adividing key with gain proportional to the distance value of the pointin question. For a contour point, such that the reduced difference, Dmaxreduced-Dmin reduced, is less than or equal to 0, the dividing key isthe binary key. If the reduced difference is greater than 0 and thedistance value of the point in question is included between Dmin reducedand Dmax reduced, the dividing key is obtained from the followingformula:

    key=(DIST-Dmin reduced)/(Dmax reduced-Dmin reduced)

If the difference is greater than 0 and the distance value of the pointin question is less than Dmin reduced (or greater than Dmax reducedrespectively), the value of the dividing key is equal to 0 (or equal to1 respectively).

A dividing key thus obtained allows the inlaying of the source image onthe new background, but necessitates specific processings before beingable to be used in a satisfactory manner. The first specific processingrelates to the elimination by a device 44 of isolated points remainingin the key, that is to say any point whose dividing key value is totallydifferent from that of the adjacent points. Any point vertically orhorizontally framed by two points having a key value 0 (or 1respectively) will have its key value set to 0 (or 1 respectively). Theelimination of these aberrant points, generally due to the colouredbackground of the source image, allows them to be ignored in the choiceof the optimum threshold value, insofar as they are not reproduced ontwo consecutive lines.

After elimination of isolated points, the dividing key is subjected to aselective horizontal filtering 45. In fact, when a contour ispractically horizontal, the points belonging to this contour are notdetected as the extraction of the contour is carried out line by lineand only the vertical or oblique transitions are sought. The selectivehorizontal filtering allows detection of these horizontal transitions inthe dividing key and allows them to be artificially softened, in orderto avoid them appearing as a broken line in the inlaid image.

Finally, the dividing key having been obtained by line by lineprocessing, off-sets between two consecutive lines can appear givingrise to a significant flickering of the inlaid image on the horizontaltransitions. It therefore appears necessary to carry out a verticalfiltering 46 on the dividing key in order to re-correlate the variouslines with each other. For example, a filter giving a vertical averageover three points gives good results.

The dividing key signal with gain obtained at the end of this processingcan be used directly for the luminance inlaying. A similar key iscomputed for the inlaying of colour difference signals, necessitating asignal sampled at a frequency which is half that of the luminancesignal. The dividing key Y is therefore passed through a low passsub-sampling filter in order to obtain a dividing key C_(R) /C_(B).

The two dividing Y key and C_(R) /C_(B) key signals being available, themixing between the source video and the background video can be carriedout. Even though constituting two separate entities, because of thefrequency difference, the luminance and colour difference inlays arecarried out in the same manner. Accordingly, the following descriptionis given with reference to the luminance signals but can be directlyapplied to the colour difference signals.

A conventional linear mixing has a certain number disadvantages. In aconventional linear mixing, the value of an inlaid point depends on thevalue of the corresponding source point and on the level of the dividingsignal according to the formula:

    Yinl(p)=key(p) * Ys(p)+(1-key(p)) * Ynbackground(p)

where Yinl(p), Ys(p) and Ynbackground(p) respectively represent theafter-inlaying, source and new background values respectively of a pointp of the image.

This type of mixing causes the appearance on the transitions of alowering or an excess of luminance inherent in the values of Ys(p) andYnbackground(p) on the transition.

Thus, the values Ys(p) contain, for most of the transition points, aluminance section of the blue (or other) of the background which istherefore reinjected in the inlaid image, causing a bright or darkfringe on the contour of the subject. The same disadvantage on thecolour difference components C_(R), C_(B) can give rise to a colouringof this fringe. The improvement provided consists in fixing Ys(p) andYnbackground (p) at constant values on the transition, effectivelyrepresenting luminance values of the subject and of the new background.

The pseudo-linear mixing is therefore carried out according to theformula:

    Y inl(p)=key (p) * VALSOURCE+(1-key (p)) * VALBACKGROUND

The values VALSOURCE and VALBACKGROUND are determined on eachtransition. In the case of a background/subject transition,VALBACKGROUND is the value of Ybackground at the last point beforetransition whose dividing key value is 0, VALSOURCE is the value of Ysat the point whose dividing key value is a maximum on the transition.The reverse reasoning is applied in the case of a subject/backgroundtransition.

The improvements provided, on the one hand by a control of thetransition on a contour of variable width of the subject and, on theother hand, by a pseudo-linear mixing, allows the obtaining of an inlaidimage which is practically perfect at the level of the subject/newbackground to transitions. However, neither the transparency effects northe fine details, nor the shadows are reproduced in it. It is necessaryto inject them into the inlaid image in order to obtain the final inlaidimage 9.

It should be noted that the fine details, transparency and shadows areprocessed in the same manner. The only reservation to be made is thefact that the adjustments can be different in the case of elements whichare lighter than the former background or in the case of elements whichare darker than the former background. In the rest of the description,the term "details" denotes both the transparency effect (fog, glass,smoke), shadows, and fine details.

The first processing relating to the details consists in the detectionof the latter.

FIG. 8 shows an example of inlaying luminance details according to theinvention.

For the luminance component of the source image, the value Ys(p)-Y₀ iscomputed at each point of the image where the dividing key is differentfrom 1 (transitions background). The parameter Y₀ represents the averagevalue of the luminance over the background, and is computed bydetermining the average of the luminance levels over the window enteredby the user during the determination of C_(R) background and C_(B)background. In the case of details which are lighter than thebackground, the value Ys(p)-Y₀ is considered such that, in the case ofdarker details, it is necessary to take its absolute value.

In what follows, in order to simplify it, the absolute values have beenvoluntarily ignored and only the light details are therefore considered.

However, the reasoning used is strictly identical for the dark details,replacing (Ys(p)-Y₀) with |Ys(p)-Y₀ |.

If Ys(p)-Y₀ is less than a low threshold SB fixed by the user, thecorresponding point is considered as not being a detail.

If Ys(p)-Y₀ is greater than a high threshold SH to be determined by theuser, the corresponding point is considered as being an integral part ofa detail. Between the two thresholds SH, SB, the corresponding point is"more or less" a detail according to the value of Ys(p)-Y₀. In otherwords, the equations allowing the inlaying of light luminance detailsare as follows:

(a). if Ys(p)-Y₀ <SB, Yinl(p) unchanged.

(b). if Ys(p)-Y₀ >SH, Yinl(p)=Ys(p)+param

(c). if SB<Ys(p)-Y₀ <SH

    Yinl(p)=[Ynbackground(p)-Y.sub.0 -SH-param)* (Ys(p)-Y.sub.0)+SB(Y.sub.0 +SH+param)-Ynbackground(p)*SH]/(SB-SH).

The parameter param allows the adjustment of the luminance level of thedetails with respect to the luminance level of the source image.

Between the high threshold SH and the low threshold SB, the details arere-inlaid in proportion to the value of Ys(p)-Y₀. The coefficients ofthe equation (c) have been computed such that (a) and (c) provide anidentical value of Yinl(p) in the limit condition Ys(p)-Y₀ =SB, andsimilarly for (b) and (c) in the case where Ys(p)-Y₀ =SH.

The luminance inlaying of details therefore necessitates the adjustmentof three parameters: SB, SH, param.

The low threshold SB allows the adjustment of the level from which apoint is a detail. If SB=0 all of the non-uniformities of the formercoloured background are re-transposed into the inlaid image. Theadjustment of the low threshold SB therefore allows a compromise betweenthe pollution of the new background by the noise of the formerbackground and the correct reproduction of hardly visible details.

The high threshold SH, or more exactly the difference between the highthreshold SH and the threshold SB, allows the definition of the zone ofproportionality of reproduction of details and therefore of the slope ofthe "straight line" of proportionality (a straight line in the case of azone of homogeneous new background). The smaller the slope of the"straight line" becomes (difference SH-SB high) the smaller theproportion of re-transcribed details becomes and vice-versa. It shouldbe noted that the slope of the "straight line" does not only depend onthe difference between the high threshold SH and the low threshold SBbut also on the difference between the luminance of the new backgroundand the luminance of the source image. As a general rule, the higher thedifference in luminance between the new background and the source image,the greater the difference between the high threshold SH and the lowthreshold SB must be in order to obtain a correct result.

Finally, the "param" parameter allows an increase or reduction in theluminance of the details with respect to that of the source image. Inmost cases, param is set to zero (the default value), particularly inthe frequent case in which the details touch the subject. A non-zerovalue of param would then cause an offset between the luminance of thesubject and the luminance of the details, generating a discontinuity inthe inlaid image.

FIG. 9 shows an example of the inlaying of details, as a colourdifference, according to the invention.

The inlaying of colour difference signals is carried out according tothe same principle except that above the high threshold SH the colour ofthe re-transcribed details is not the original one but a grey level(C_(R) =128, C_(B) =128), and that the zone of proportionality of thenew background is desaturated.

Thus

if Ys(p)-Y₀ <SB, C_(R) inl(p) is unchanged

if Ys(p)-Y₀ >SH, C_(R) inl(p)=128+param C_(R)

if SB<Ys(p)-Y₀ <SH

    C.sub.R inl(p)=[(C.sub.R nbackground(p)-128-param C.sub.R)*(Ys(p)-Y.sub.0)+SB(128+param C.sub.R)-C.sub.R nbackground(p)*SH]/(SB-SH)

The same relationships are applied for C_(B) inl(p), replacing C_(R)with C_(B), SB and SH being identical.

The values of the low threshold SB and the high threshold SH are fixedby default at the same values as those used for the inlaying inluminance but can if desired be changed by the user. Similarly paramC_(R) and param C_(B) are fixed by default to the value of param(generally 0), but can also be changed independently from each other inorder to colour the details of the inlaid image.

The method according to the invention allows the obtaining ofsatisfactory inlaid images necessitating very few adjustments in thegreat majority of cases: only one threshold adjustment for an imagewithout details, three adjustments (threshold; SH; SB) for an image withdetails which are lighter or darker than the background, fiveadjustments (threshold; SH, SB light details; SH, SB dark details) foran image with light and dark details, while all of the other parametersdefined above such as C_(R) background, C_(B) background, Y₀, width ofthe window representative of the background, threshold distance, cangenerally assume the values fixed by default without degrading thequality of the inlaying.

The present invention is not limited to the examples precisely describedand shown.

Various modifications can be applied to it without departing from thescope of the invention. In particular, the characterisation of thebackground by a circle can be with an elliptical characterisation. Thedistance value DIST from a point of the source image to be backgroundwould then be written:

    DIST=[k (C.sub.R -C.sub.R background).sup.2 +k.sub.0 (C.sub.B -C.sub.B background).sup.2 ]1/2

where k is different from k₀. It is also possible to change the axes ofthe ellipse or again to define any closed area characterising thebackground in the chromatic plane (C_(R), C_(B))

Similarly, the detection of contours line by line allows only thedetection of background/subject transitions which are vertical or atleast treated as such, but it is possible to carry out a contourdetection allowing the defining of the direction of the transitions andto work on the latter perpendicularly to the determined direction.

We claim:
 1. A method for inlaying color video images, including thegeneration of a switching signal, or dividing key signal, to which again is applied in order to extract from a source image a subject placedin front of an original background of uniform color, and carrying out amixing of the subject with a new background image, comprising the stepsof:detecting background/subject and subject/background transitionsdynamically in the source image according to distance values betweenpoints of the subject and points of the background, defining a contourof the subject as an outer perimeter edge region around the subject andhaving a variable width depending upon determined characteristics of thedetected transition, said width being calculated, at each transition,from the evolution of the distance values of localized points around thetransition, and applying the gain only to selected points of the sourceimage belonging to the contour of the subject, and in proportion to thedistance value between said selected points and points of said originalbackground.
 2. The method according to claim 1, wherein the mixing isperformed at each point of the subject and is such that the mixing is afunction of the values of the dividing key signal at said selectedpoints, and the dividing key signal values of the points of the sourceimage and the points of the new background ar fixed constants over thewidth of the contour.
 3. The method according to claim 1, wherein thewidth of the contour of the subject is determined in each image line bydetecting the subject/background or background/subject transitions, bycomparison, for each point of the source image, of its distance valuewith a threshold value and by passing through, for each transition, thepoints located on either side of the transition until a minimum distanceor maximum distance value is obtained corresponding to the start or endof the transition and delimiting the width of the contour for each saidtransition.
 4. The method according to claim 3, wherein the width of thecontour corresponding to a transition is reduced in order to avoidoscillations on either side of the contour.
 5. The method according toany one of the preceding claims, wherein the width of the contours islimited to a maximum value by a user.
 6. The method according to claim1, wherein isolated points having key signal values which aresignificantly different from key signal values of adjacent points aredetected and eliminated.
 7. The method according to claim 1, whereinhorizontal transitions are detected and smoothed.
 8. The methodaccording to claim 1, wherein a vertical filtering is carried on thedividing key signal.
 9. The method according to claim 1, wherein pointsof the source image corresponding to details, shadows and transparenciesare detected by comparing a luminance difference between the subject andthe original background with two threshold values consisting of a highthreshold value and a low threshold value, and wherein linear mixingbetween the subject and the new background is carried out according tothe value of said luminance difference when said luminance difference isincluded between the two threshold values.
 10. A device for inlaying ofcolor video images, including the generation of a switching signal, ordividing key signal, to which a gain is applied in order to extract froma source image a subject placed in front of an original background ofuniform color, and including mixing of the subject with a new backgroundimage, comprising:interpolating means for interpolation of colordifference signals; computing means for computing a luminance dividingkey in accordance with said color difference signals; low pass filtermeans for performing low pass filtering having an input for receivingthe luminance dividing key signal and an output for supplying a dividingkey signal which allows the inlaying of the color deference signals;means for inlaying the color difference signal shaving an input forreceiving the color difference signals, source and background signals,an the dividing key signal; means for inlaying a luminance signal havingan input for receiving source and background luminance signals and thedividing key signal; and means for inlaying details, shadows andtransparencies, having an input for receiving the luminance signals andcolor difference signals of the source signal and of the video signalafter inlaying as well as the dividing key signal, wherein a finalinlayed image is obtained.
 11. A device according to claim 10, whereinthe means for computing the dividing key further comprises, inseries,means for computing distances; means for comparing said distanceswith a threshold; means for extracting a contour of variable width;means for computing a gain for points belonging to a contour; means foreliminating isolated points; means for performing selective horizontalfiltering; and means for performing vertical filtering.